import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';

import '../../routes/app_pages.dart';

class SplashLogic extends GetxController with GetSingleTickerProviderStateMixin {
  late AnimationController controller;
  late Animation<double> animation;

  @override
  void onInit() {
    super.onInit();
    // controller = AnimationController(duration: const Duration(milliseconds: 1000), vsync: this);
    // Animation<double> curve = CurvedAnimation(parent: controller, curve: Curves.easeOut);
    // animation = Tween(begin: 84.0, end: 0.0).animate(curve)
    //   ..addListener(() {
    //     update();
    //   })
    //   ..addStatusListener((status) {
    //     if (status == AnimationStatus.completed) {
    //
    //     }
    //   });
    Future.delayed(const Duration(microseconds: 100), () {
      _openHomePage();
    });
  }

  @override
  void onReady() {
    super.onReady();
    // controller.forward();
  }

  @override
  void onClose() {
    // controller.dispose();
    super.onClose();
  }

  void _openHomePage() {
    Get.offNamed(Routes.index);
  }
}
